<?php
namespace app\finance\admin;
use app\system\admin\Admin;
use app\product\model\Supplier as SupplierModel;
use app\finance\model\Account as AccountModel;
use think\Db;
class Supplier extends Admin
{
	 protected $hisiModel = '';

	 public function bill()
	 {
	 	if($this->request->isAjax()){
    		$where      = $data = [];
            $page       = $this->request->param('page/d', 1);
            $limit      = $this->request->param('limit/d', 15);
            // $keyword    = $this->request->param('keyword/s');

            // if ($keyword) {
            //     $where[] = ['name', 'like', '%'.$keyword.'%'];
            // }    
            $where['out_in'] = 2; 
            $data['data']   = Db::name('supplier_money')->alias('sm')
				            ->join('hisi_supplier s','s.id=sm.supplier_id')
				            ->join('hisi_account a','a.id=sm.account_id')
				            ->field('sm.*,s.name as supplier_name, a.name as account_name')
				            ->where($where)
				            ->page($page)->limit($limit)->select();
            $data['count']  = Db::name('supplier_money')->where($where)->count('id');
            $data['code']   = 0;
            return json($data);
    	}
    	return $this->fetch();
	 }

}